import { Column, UpdateDateColumn, CreateDateColumn } from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';

export abstract class BaseEntity {
  @ApiProperty({ description: '状态', type: String })
  @Column({
    type: 'char',
    name: 'status',
    default: '1',
    comment: '状态 0:禁用 1:启用',
    length: 1,
  })
  public status: string | number;

  @ApiProperty({ description: '创建时间', type: Date })
  @CreateDateColumn({ type: 'timestamp', default: null, name: 'create_time' })
  public createTime: Date;

  @ApiProperty({ description: '创建人', type: String })
  @Column({ type: 'varchar', length: 50, default: '', name: 'create_user' })
  public createUser: string;

  @ApiProperty({ description: '更新时间', type: Date })
  @UpdateDateColumn({ type: 'timestamp', default: null, name: 'update_time' })
  public updateTime: Date;

  @ApiProperty({ description: '更新人', type: String })
  @Column({ type: 'varchar', length: 50, default: '', name: 'update_user' })
  public updateUser: string;

  @ApiProperty({ description: '备注', type: String })
  @Column({ type: 'varchar', length: 100, default: '', name: 'remark' })
  public remark: string;
}
